<?php
/* @var $this UserController */
/* @var $model User */
/* @var $form CActiveForm */

    $baseUrl = Yii::app()->baseUrl; 
    $cs = Yii::app()->getClientScript();
    //$cs->registerCssFile($baseUrl.'/css/formStyle.css');
    $cs->registerScriptFile("http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js");
    $cs->registerScriptFile($baseUrl . "/js/jquery.slimscroll.min.js");
    
    $date = date_parse($model->birthday);
?>
<script type="text/javascript">
	jQuery(document).ready(function(){
       jQuery('.customselect').customSelect();
	   jQuery('.register_form input[type="text"],.register_form input[type="password"]').focus(function(){
			jQuery(this).parent('p').addClass('pfocus');
	   });
	   jQuery('.register_form input[type="text"],.register_form input[type="password"]').focusout(function(){
			jQuery(this).parent('p').removeClass('pfocus');
	   });
	   jQuery('.register_form input[type="text"],.register_form input[type="password"]').mouseover(function(){
			jQuery(this).parent('p').addClass('phover');
	   });
	   jQuery('.register_form input[type="text"],.register_form input[type="password"]').mouseout(function(){
			jQuery(this).parent('p').removeClass('phover');
	   });
       jQuery('#User_username').blur()
	});
</script>

<script type="text/javascript">

</script>
<style>
    img{
        float: left;
    }
    
    
</style>

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'user-form',
	'enableAjaxValidation'=>true,
    'htmlOptions' => array('class' => 'content_form register_form','enctype' => 'multipart/form-data'),
)); ?>

    <p class="input_wrapper">
        <img src="<?php echo Yii::app()->theme->baseUrl; ?>/front/images/icon_reg_user.png" />
        <?php //echo $form->textField($model,'username'); ?>
        <?php echo $form->textField($model,'username',array('placeholder' => "Tên đăng nhập")); ?>
        <?php echo $form->error($model,'username'); ?>
    </p>
    <p class="input_wrapper">
        <img src="<?php echo Yii::app()->theme->baseUrl; ?>/front/images/icon_reg_pass.png" />
        <?php //echo $form->textField($model,'newpassword'); ?>
        <input type="password" name="newpassword" placeholder="Mật khẩu" /> 
        <?php //echo $form->hiddenField($model,'password', array('value' => $model->password)); ?>
        <?php echo $form->error($model,'password'); ?>
    </p>
	<p class="input_wrapper">
        <img src="<?php echo Yii::app()->theme->baseUrl; ?>/front/images/icon_reg_email.png" />
        <?php //echo $form->textField($model,'email'); ?>
        <?php echo $form->textField($model,'email', array('placeholder' => 'Email')); ?>
            <?php echo $form->error($model,'email'); ?>
    </p>
    <p class="input_wrapper">
        <img src="<?php echo Yii::app()->theme->baseUrl; ?>/front/images/icon_reg_user.png" />
        <?php //echo $form->textField($model,'name'); ?>
        <?php echo $form->textField($model,'name',  array('placeholder'=> 'Họ và tên')) ; ?>
        <?php echo $form->error($model,'name'); ?>
    </p>
					
	<p>
        <img src="<?php echo Yii::app()->theme->baseUrl; ?>/front/images/icon_reg_date.png" />
        <select name="day" class="customselect smallselect">
    		<option value="00">Ngày</option>
            <?php for($i = 1; $i <= 31; $i++) :?>
                <option <?php if($i == $date['day']) echo 'selected="selected"' ?> value="<?php echo $i; ?>">
                    <?php echo $i; ?>
                </option>
            <?php endfor;?>
    	</select>
    	<select name="month" class="customselect smallselect hasCustomSelect">
    		<option value="00">Tháng</option>
            <?php for($i = 1; $i <= 12; $i++) :?>
                <option <?php if($i == $date['month']) echo 'selected="selected"' ?> value="<?php echo $i; ?>"><?php echo $i; ?></option>
            <?php endfor;?>
    	</select>
    	<select name="year" class="customselect mediumselect hasCustomSelect">
    		<option value="0000">Năm sinh</option>
            <?php for($i = 1930; $i <= date('Y') - 1; $i++) :?>
                <option <?php if($i == $date['year']) echo 'selected="selected"' ?> value="<?php echo $i; ?>">
                    <?php echo $i; ?>
                </option>
            <?php endfor;?>
    	</select>
	</p>
	
	<p class="input_wrapper">
        <img src="<?php echo Yii::app()->theme->baseUrl; ?>/front/images/icon_reg_sex.png" />
        <select name="User[gender]" class="customselect">
    		<option value="-1">Giới Tính</option>
    		<option <?php if($model->gender == 1) echo 'selected="selected"' ?> value="1">Nam</option>
    		<option <?php if($model->gender == 0) echo 'selected="selected"' ?> value="0">Nữ</option>
    		<option <?php if($model->gender == 2) echo 'selected="selected"' ?> value="2">Không xác định</option>
    	</select>
    </p>
	<p class="input_wrapper">
        <img src="<?php echo Yii::app()->theme->baseUrl; ?>/front/images/icon_reg_call.png" />
            <?php //echo $form->textField($model,'phone'); ?>
            <?php echo $form->textField($model,'phone',array('placeholder' => 'Số điện thoại')); ?>
            <?php echo $form->error($model,'phone'); ?>
    </p>
    <p class="input_wrapper">
        <input type="file" name="User[avatar_url]" />
        <?php //echo $form->fileField($model,'avatar_url'); ?>
        <?php echo $form->error($model,'avatar_url'); ?>
    </p>
    <p class="input_wrapper">
        <?php echo CHtml::submitButton($model->isNewRecord ? $model->getAttributeLabel('Đăng ký') : $model->getAttributeLabel('saveButton')); ?>
    </p>
<?php $this->endWidget(); ?>

<!-- form -->